﻿using System.Globalization;
using System.Windows.Data;
using Windows.UI.Xaml;
namespace CoreModule.Converters
{
    /// <summary>
    /// 数值范围 to 显示
    /// </summary>
    public class IntRangeToVisibilityConverter : IValueConverter
    {
        /// <summary>
        /// 包括
        /// </summary>
        public int Min { get; set; } = 1;
        /// <summary>
        /// 不包括
        /// </summary>
        public int Max { get; set; } = int.MaxValue;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var v = (int)value;

            if (v >= Min && v < Max)
            {
                return Visibility.Collapsed;
            }
            else
            {
                return Visibility.Collapsed;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
